﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	public abstract class AuxiliaryDraw
	{
		public AuxiliaryDraw(ExternalCommandData amdArgu, Dictionary<XYZ, XYZ> dicXArgu, Dictionary<XYZ, XYZ> dicYArgu, ref ICollection<ElementId> idsArgu)
		{
			this.ids = idsArgu;
			this.m_CmdData = amdArgu;
			this.dicX = dicXArgu;
			this.dicY = dicYArgu;
		}

		public abstract bool DrawCurve();

		public bool IsInTolerance()
		{
			foreach (KeyValuePair<XYZ, XYZ> keyValuePair in this.dicX)
			{
				XYZ key = keyValuePair.Key;
				XYZ value = keyValuePair.Value;
				if (key.DistanceTo(value) <= this.m_CmdData.Application.Application.ShortCurveTolerance)
				{
					this.dicX.Clear();
					this.dicY.Clear();
					return false;
				}
			}
			foreach (KeyValuePair<XYZ, XYZ> keyValuePair2 in this.dicY)
			{
				XYZ key2 = keyValuePair2.Key;
				XYZ value2 = keyValuePair2.Value;
				if (key2.DistanceTo(value2) <= this.m_CmdData.Application.Application.ShortCurveTolerance)
				{
					this.dicX.Clear();
					this.dicY.Clear();
					return false;
				}
			}
			return true;
		}

		protected Dictionary<XYZ, XYZ> dicX;

		protected Dictionary<XYZ, XYZ> dicY;

		protected ExternalCommandData m_CmdData;

		protected ICollection<ElementId> ids;
	}
}
